package mostVisited;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

class Solution {
    public List<Integer> mostVisited(int n, int[] rounds) {
        List<Integer> ans=new ArrayList<>();
        int i=rounds[0];
        int j=rounds[rounds.length-1];
        ans.add(i);
        while(i!=j){
            i++;
            if(i>n){
                i-=n;
            }
            ans.add(i);
        }
        Collections.sort(ans);
        return ans;

        // 差分数列 每次都让 区间[rounds[i],rounds[i-1]]+1;
    }
}
